package com.tanhua.dubbo.api;

import com.tanhua.model.mongo.Movement;
import com.tanhua.model.mongo.MovementTimeLine;
import org.apache.dubbo.config.annotation.DubboService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import java.util.List;

@DubboService
public class MovementTimeLineApiImpl implements MovementTimeLineApi {
@Autowired
private MongoTemplate mongoTemplate;
    @Override
    public List<MovementTimeLine> findUser(Long userId) {
        Criteria criteria = Criteria.where("friendId").is(userId);
        Query query = Query.query(criteria);
        List<MovementTimeLine> movementTimeLines = mongoTemplate.find(query, MovementTimeLine.class);
        return movementTimeLines;
    }
}
